package com.servicio.panel;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

import com.servicio.styles.Styles;

@SuppressWarnings("serial")
public class IniciarSesion extends JPanel {

  private JLabel user = new JLabel("Usuario: ");
  private JLabel password = new JLabel("Contraseña: ");

  private JTextField jTextFieldUser = new JTextField(15);
  private JPasswordField passwordField = new JPasswordField(15);

  public IniciarSesion() {
    
    JLabel titulo=new JLabel("Iniciar Sesion");
    Styles.textoSesion(user,20);
    Styles.textoSesion(password,20);
    Styles.titulo(titulo,30,20);
    Styles.tamBorder(this, 150);

    this.setOpaque(false);
    this.agregarElementos(titulo);

  }
  
  private void agregarElementos(JLabel titulo){
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    this.setLayout(gridbag);
    confGBC(c, 0, 0, 2, 2);
    this.add(titulo,c);
    confGBC(c, 0, 2, 1, 1);
    this.add(user,c);
    confGBC(c, 1, 2, 1, 1);
    this.add(jTextFieldUser,c);
    confGBC(c, 0, 3, 1, 1);
    this.add(password,c);
    confGBC(c, 1, 3, 1, 1);
    this.add(passwordField,c);
  }
  
  private void confGBC(GridBagConstraints c,int gX,int gY, int gW, int gH){
    c.gridx = gX;
    c.gridy = gY;
    c.gridwidth = gW;
    c.gridheight = gH;    
  }

}
